import request from '@/utiles/request.js'

export const gethrlist = async () =>{
  return await request.get('/api/hr/list')
}

// 记录操作日志
export const recordHrOperation = async (logData) => {
  return await request.post('/api/hr/record', logData)
}

// 新增员工
export const addEmployee = async (employeeData) => {
  return await request.post('/api/hr/add', employeeData)
}

// 删除员工
export const deleteEmployee = async (userId) => {
  return await request.delete(`/api/hr/delete/${userId}`)
}

// 修改员工信息
export const updateEmployee = async (employeeData,userId) => {
  return await request.put(`/api/hr/change/${userId}`, employeeData)
}

// 批量更新员工
export const batchUpdateEmployees = async (ids, updateData) => {
  return await request.put('/api/hr/batch-update', { ids, updateData })
}

// 批量删除员工
export const batchDeleteEmployees = async (ids) => {
  return await request.delete('/api/hr/batch-delete', { data: { ids } })
}

// 获取操作日志列表
export const getHrRecordList = async () => {
  return await request.get('/api/hr/record/list')
}

// 删除单条操作日志
export const deleteHrRecord = async (recordId) => {
  return await request.delete(`/api/hr/record/delete/${recordId}`)
}

// 批量删除操作日志
export const batchDeleteHrRecords = async (recordIds) => {
  return await request.delete('/api/hr/record/batch-delete', { data: { recordIds } })
}

// 更新操作日志备注
export const updateHrRecord = async (recordId, remark) => {
  return await request.put(`/api/hr/record/update/${recordId}`, { remark })
}

